<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改商品信息')" />
    <script type="text/javascript" src="../../../js/jquery.min.js"></script>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-product-edit" th:object="${wmsProduct}">
            <input name="pId" th:field="*{pId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品名称：</label>
                <div class="col-sm-8">
                    <input name="pName" th:field="*{pName}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">单位(计量单位)：</label>
                <div class="col-sm-8">
                    <input name="pUnits" th:field="*{pUnits}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品售价：</label>
                <div class="col-sm-8">
                    <input name="pPrice" th:field="*{pPrice}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品进价：</label>
                <div class="col-sm-8">
                    <input name="pCost" th:field="*{pCost}" class="form-control" type="text">
                </div>
            </div>
            <div class="col-md-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">供应商：</label>
                    <div class="col-sm-8">
                        <select class="form-control" id="gys" name="sId">

                        </select>
                    </div>
                </div>
            </div>
            <!--<div class="form-group">
                <label class="col-sm-3 control-label">供应商：</label>
                <div class="col-sm-8">
                    <input name="sId" th:field="*{sId}" class="form-control" type="text">
                </div>
            </div>-->
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品描述：</label>
                <div class="col-sm-8">
                    <input name="pDesc" th:field="*{pDesc}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />

    <script type="text/javascript">
        var prefix = ctx + "wms/product"
        $("#form-product-add").validate({
            focusCleanup: true
        });
        $(function () {

            $.post("/wms/supplier/list",function (result) {
                for (var i in result.rows) {
                    $("#gys").append("<option value='"+result.rows[i].sId+"'>"+result.rows[i].sName+"</option>")
                }
            })
        })


        var prefix = ctx + "wms/product";
        $("#form-product-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-product-edit').serialize());
            }
        }
    </script>
</body>
</html>